const UserTag = require('../db/model/user_tag');
const cryptoHelper = require('../helper/crypto');

const add = async (name, code, shortcut) => {

    let record = await UserTag.query().insert({
        user_id,
        title,
    });

    return record;
};

const get = async (id) => {

    let record = await UserTag.query().findOne({id});

    return record;
};

const update = async (id, title) => {

    let record = await UserTag.query().update({title}).where("id", id);

    return record;
};

const remove = async (id) => {

    let record = await UserTag.query().where("id", id).del();

    return record;
};

//  REBOL todo, pager, limit
const list = async (user_id) => {

    let record = await UserTag.query().select().where("user_id", user_id);

    return record;
};

module.exports = {
    add,
    get,
    update,
    remove,
    list,
};